package cn.wolfcode.shop.config;

import cn.wolfcode.shop.alipay.AlipayProperties;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyAlipayConfig {
    @Autowired
    private AlipayProperties properties;

    @Bean
    public AlipayClient alipayConfig() {
        return new DefaultAlipayClient(properties.getGatewayUrl(),
                properties.getAppId(), properties.getMerchantPrivateKey(),
                "json", properties.getCharset(),
                properties.getAlipayPublickey(), properties.getSigntype());
    }
}
